﻿@model PagedList<Core_Order>
@{
    ViewBag.ParentUrl = "/Order/Index";
    ViewBag.Title = "保单查询";
}
@section breadcrumb
{
    <ul class="breadcrumb">
        <li>
            <i class="ace-icon fa fa-home home-icon"></i>
            <a href="/">首页</a>
        </li>
        <li class="active">@ViewBag.Title</li>
    </ul><!-- .breadcrumb -->
}
<div class="row">
    <div class="col-xs-12">
        <div class="table-responsive">

            <form action="/order/index" method="get">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="widget-box">
                            <div class="widget-header">
                                <h5 class="widget-title">高级搜索</h5>

                                <div class="widget-toolbar">
                                    <a href="#" data-action="collapse">
                                        <i class="1 ace-icon fa bigger-125 fa-chevron-up"></i>
                                    </a>
                                </div>
                            </div>

                            <div class="widget-body">
                                <div class="widget-main">
                                    <form class="form-search" method="GET">
                                        <div class="row">

                                            <div class="col-xs-12 col-sm-3">
                                                <label>
                                                    产品计划
                                                </label>
                                                <div class="row">
                                                    <div class="col-xs-8 col-sm-12">
                                                        @Html.DropDownList("Product", (List<SelectListItem>)TempData["Product"], new { @class = "col-xs-12 col-sm-3", style = "width: 360px;" })
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="col-xs-12 col-sm-3">
                                                <label>
                                                    保单号
                                                </label>
                                                <div class="row">
                                                    <div class="col-xs-8 col-sm-11">
                                                        <input type="text" placeholder="保单号" id="no" name="no" value="@Request.QueryString["no"]">
                                                    </div>
                                                </div>
                                            </div>


                                            <div class="col-xs-12 col-sm-3">
                                                <label>
                                                    投保人
                                                </label>
                                                <div class="row">
                                                    <div class="col-xs-8 col-sm-11">
                                                        <input type="text" placeholder="投保人" id="uname" name="uname" value="@Request.QueryString["uname"]">
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="col-xs-12 col-sm-3">
                                                <label>
                                                    投保状态
                                                </label>

                                                <div class="row">
                                                    <div class="col-xs-8 col-sm-12">
                                                        <select id="state" name="state">
                                                            <option value="-2">==请选择==</option>
                                                            <option value="-1">待处理</option>
                                                            <option value="0">投保生效</option>
                                                            <option value="1">已撤销</option>
                                                            <option value="2">过期退保</option>
                                                        </select>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-xs-12 col-sm-3">
                                                <label for="st">
                                                    生效时间
                                                </label>
                                                <div class="row">
                                                    <div class="col-xs-8 col-sm-11">
                                                        <div class="input-daterange input-group">
                                                            <input type="text" class="input-sm form-control time-item" name="savailtime" id="savailtime" value="@Request.QueryString["savailtime"]">
                                                            <span class="input-group-addon">
                                                                <i class="fa fa-exchange"></i>
                                                            </span>

                                                            <input type="text" class="input-sm form-control time-item" name="eavailtime" id="eavailtime" value="@Request.QueryString["eavailtime"]">
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>

                                            <div class="col-xs-12 col-sm-3">
                                                <label for="et">
                                                    单证号段
                                                </label>

                                                <div class="row">
                                                    <div class="col-xs-8 col-sm-11">
                                                        <div class="input-daterange input-group">
                                                            <input type="number" class="input-sm form-control" name="sno" id="sno" value="@Request.QueryString["sno"]">
                                                            <span class="input-group-addon">
                                                                <i class="fa fa-exchange"></i>
                                                            </span>

                                                            <input type="number" class="input-sm form-control" name="eno" id="eno" value="@Request.QueryString["eno"]">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="col-xs-12 col-sm-3">
                                                <label for="key">
                                                    创建时间
                                                </label>

                                                <div class="row">
                                                    <div class="col-xs-8 col-sm-11">
                                                        <div class="input-daterange input-group">
                                                            <input type="text" class="input-sm form-control time-item" name="stime" id="stime" value="@Request.QueryString["stime"]">
                                                            <span class="input-group-addon">
                                                                <i class="fa fa-exchange"></i>
                                                            </span>

                                                            <input type="text" class="input-sm form-control time-item" name="etime" id="etime" value="@Request.QueryString["etime"]">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="col-xs-12 col-sm-3">
                                                <label for="et">
                                                    -
                                                </label>

                                                <div class="input-group">
                                                    <button type="submit" class="btn btn-info btn-sm">
                                                        立即查询
                                                        <i class="fa fa-search"></i>
                                                    </button>
                                                </div>
                                            </div>

                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
            <div class="hr hr-18 dotted hr-double"></div>
            <h4 class="pink">
                <i class="ace-icon fa fa-hand-o-right icon-animated-hand-pointer blue"></i>
                <a href="###" role="button" class="green" data-toggle="modal"> 保单数据详情 </a>
            </h4>

            <!-- PAGE CONTENT BEGINS -->
            <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                <thead>
                    <tr>
                        <th>序号</th>
                        <th>保单号</th>
                        <th>单证号</th>
                        <th>被保人</th>
                        <th>产品名称</th>
                        <th>出单用户</th>
                        <th>投保时间</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model)
                    {
                        <tr>
                            <td>@item.O_Id</td>
                            <td>@item.O_PolicyNo</td>
                            <td>@item.O_TicketNo</td>
                            <td>@item.O_InsureName</td>
                            <td>@item.O_ProductName</td>
                            <td>@item.O_WorkerName</td>
                            <td>@item.O_CreateTime</td>
                            <td>
                                @Enum.GetName(typeof(OrderStateEnum),item.O_State)
                            </td>
                            <td>
                                <div class="btn-group">
                                    <a class="btn btn-xs btn-info tooltip-info" data-rel="tooltip" data-placement="top" href="/order/Info/@item.O_Id">
                                        详细
                                        <i class="ace-icon fa fa-eye bigger-120"></i>
                                    </a>
                                </div>
                                @if (item.O_State == 0)
                                {
                                    <div class="btn-group">
                                        <a class="btn btn-xs btn-purple tooltip-info" data-rel="tooltip" data-placement="top" data-val="@item.O_Id" name="btnOption">
                                            退保
                                            <i class="ace-icon fa fa-ban bigger-120"></i>
                                        </a>
                                    </div>
                                }
                                <div class="btn-group">
                                    <a class="btn btn-xs btn-warning tooltip-info" data-rel="tooltip" data-placement="top" href="###" data-val="@item.O_Id" name="btnPrint">
                                        打印
                                        <i class="ace-icon fa fa-print bigger-120"></i>
                                    </a>
                                </div>
                            </td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>

    <!-- PAGE CONTENT ENDS -->
        @Html.Pager(Model, new PagerOptions { FirstPageText = "首页", PrevPageText = "上一页", NextPageText = "下一页", LastPageText = "末页", PageIndexParameterName = "id", NumericPagerItemCount = 5, ContainerTagName = "ul", CssClass = "pagination", CurrentPagerItemTemplate = "<li class=\"active\"><a href=\"#\">{0}</a></li>", DisabledPagerItemTemplate = "<li class=\"disabled\"><a>{0}</a></li>", PagerItemTemplate = "<li>{0}</li>", Id = "mvcpager" })
    </div><!-- /.col -->
</div><!-- /.row -->

@section footerScript
{
    <script src="/assets/js/laydate/laydate.js"></script>
}
@section footer{
<script src="/assets/js/bootbox.min.js"></script> 
    <script>
        lay('.time-item').each(function () {
            laydate.render({
                elem: this
                 , type: 'datetime'
              , trigger: 'click'
            });
        });


        $(function () {
            $('a[name="btnOption"]').on('click', function () {
                $.post('/order/Remove', { id: $(this).data('val') }, function (o) {
                    //alert(o.Msg);
                    if ('ok' == o) {
                        bootbox.alert("操作成功！", function () {
                            //window.location.reload();
                            location.reload();
                        });
                    } else {
                        bootbox.alert("操作有误！");
                    }
                });
            });
        });
    </script>
}